/*
 * Copyright 2007 The semap project development team.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * Created by myn at 15.08.2007 16:44:04.
 *
 * TODO <<insert description>>.
 *
 * $Id: PropertyHolder.java 425 2007-08-23 15:05:22Z falexg $
 */
package com.google.code.contactserv.model;

import com.hp.hpl.jena.rdf.model.Property;

/**
 * @author myn
 */
public class PropertyHolder {

    private String   name;
    private String   value;
//    private boolean  isOptional;
    private Property prop;

    /**
     * @param name
     * @param value
     */
    public PropertyHolder(String name, String value) {
        this.name  = name;
        this.value = value;
//        this.isOptional = true;

        if (name.equals("gender")) {
            prop = FOAF.gender;
        }
        if (name.equals("nick")) {
            prop = FOAF.nick;
        }
        if (name.equals("name")) {
            prop = FOAF.name;
        }
        if (name.equals("firstname")) {
            prop = FOAF.firstName;
        }
        if (name.equals("givenname")) {
            prop = FOAF.givenname;
        }
        if (name.equals("surname")) {
            prop = FOAF.surname;
        }
        if (name.equals("birthday")) {
            prop = FOAF.birthday;
        }
        if (name.equals("image")) {
            prop = FOAF.img;
        }
        if (name.equals("mailbox")) {
            prop = FOAF.mbox;
        }
        if (name.equals("mailboxsha1sum")) {
            prop = FOAF.mbox_sha1sum;
        }
        if (name.equals("phone")) {
            prop = FOAF.phone;
        }
        if (name.equals("homepage")) {
            prop = FOAF.homepage;
        }
        if (name.equals("weblog")) {
            prop = FOAF.weblog;
        }
        if (name.equals("workpage")) {
            prop = FOAF.workplaceHomepage;
        }
        if (name.equals("icq")) {
            prop = FOAF.icqChatID;
        }
        if (name.equals("aim")) {
            prop = FOAF.aimChatID;
        }
        if (name.equals("msn")) {
            prop = FOAF.msnChatID;
        }
        if (name.equals("yahoo")) {
            prop = FOAF.yahooChatID;
        }
        if (name.equals("jabber")) {
            prop = FOAF.jabberID;
        }
        if (name.equals("account")) {
            prop = FOAF.accountName;
        }
        /*
        if (name.equals("openid")) {
            prop = FOAF.o;
        }
        if (name.equals("residence")) {
            prop = FOAF;
        }
        */
        if (name.equals("friend")) {
            prop = FOAF.knows;
        }
    }

    /**
     * @return the name
     */
    public String getName() {
        return name;
    }

    /**
     * @return the value
     */
    public String getValue() {
        return value;
    }

    /**
     * @return the value
     */
    public Property getProperty() {
        return prop;
    }

//    public boolean isOptional() {
//        return isOptional;
//    }
//
//    public void setOptional(boolean optional) {
//        isOptional = optional;
//    }

    /* (non-Javadoc)
     * @see java.lang.Object#equals(java.lang.Object)
     */
    @Override
    public boolean equals(Object obj) {
        if (obj instanceof PropertyHolder )
            return getName().equals(((PropertyHolder)obj).getName()); 
        else
            return false;
    }
}
